<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core">
	<f:view>
		<h:form id="form">
			<div class="div_menubar">
				<p:menubar styleClass="menubar_header">
					<p:submenu label="Paciente">
						<p:menuitem value="Alterar" action="#{medicoManager.prepareUpdatePaciente}" update="form"/>
					</p:submenu>
					<p:submenu label="Documentos">
						<p:menuitem value="Imprimir Receita" actionListener="#{medicoManager.printReceita}" onclick="form.target='_blank'" target="_blank"/>
						<p:menuitem value="Imprimir Declaração" />
						<p:menuitem value="Imprimir Atestado" />
					</p:submenu>
					<p:submenu label="Arquivos">
						<p:menuitem value="Upload de Arquivos" />
					</p:submenu>
				</p:menubar>
			</div>
			
			<h:panelGroup id="panel_paciente" rendered="#{medicoManager.renderPanelPaciente}">
				<ui:include src="/medico/paginas/paciente/paciente.xhtml"></ui:include>
				<p:commandButton action="#{medicoManager.updatePaciente}" value="Atualizar Paciente" update="form, :form_consulta" rendered="#{medicoManager.renderPanelPaciente}"/>
			</h:panelGroup>
			
			<h:panelGroup rendered="#{!medicoManager.renderPanelPaciente}">
				<ui:include src="/medico/paginas/medico/ficha.xhtml"></ui:include>
				
				<p:commandButton value="Salvar Prontuário" action="#{medicoManager.saveFichaPaciente}" update="form, :form_consulta" rendered="#{medicoManager.fichaPaciente.id == null}" oncomplete="fichaDialog.hide()"/>
				<p:commandButton value="Salvar Prontuário" action="#{medicoManager.updateFichaPaciente}" update="form, :form_consulta" rendered="#{medicoManager.fichaPaciente.id != null}" oncomplete="fichaDialog.hide()"/>						
			
			</h:panelGroup>
		</h:form>
	</f:view>
</html>